<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  
</body>
<script>

  // function* getData(){
  //   yield console.log(1);
  //   yield console.log(2);
  //   yield console.log(3);
  //   yield console.log(4);
  // }
  // console.dir(getData);
  // const fn = getData()


  // console.dir(fn);
  // fn.next()
  // fn.next()
  // fn.next()
  // fn.next()


async function getData(){
console.log(`strat`);
 await new Promise((resolve,reject)=>{
  try{
    setTimeout(()=>{
  console.log(`定时器`);
  // reject()
  resolve()
},3000)
  }catch(e){
    console.log(e);
  }
 })
console.log(`定时器后`);
}
getData()
console.log(`end`);

</script>
</html>